<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC >

<%
	String action = request.getParameter("action");
	if(action != null && action.equals("login")) {
		String admin = request.getParameter("admin");
		String password = request.getParameter("password");
	    /* if(!admin.equals("admin")) {
			out.println("请输入正确的用户名");
			return;
		} 
		if(!password.equals("admin")) {
			out.println("您输入的密码不正确，请重新输入");
			return;
		} */
		
		if (!admin.equals("admin") || !password.equals("admin")) {
			out.println("username or password not correct!");
			return;
		}
		
		//out.println("ndvnd");
		session.setAttribute("admin", "admin");
		response.sendRedirect("index.jsp");
		
	}

%>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
  <center>后台登录</center>
  <form action="adminlogin.jsp" name="form" method="post">
    <input type="hidden" name="action" value="login">
    <table>
      <tr>
        <td>用户名:
          <input type="text" name="admin" size="30" value="admin">
        </td>
      </tr>
       <tr>
        <td>密码:&nbsp;&nbsp;&nbsp;&nbsp;
          <input type="password" name="password" size="30" value="admin">
        </td>
      </tr>
       <tr>
        <td>
          <input type="submit" name="submit" value="登录"> 
        </td>
      </tr>
    </table>
  </form>
</body>
</html>